﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BlockMain_Class;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;

namespace WebApplication.Controllers
{
    public class PublicController : Controller
    {
        /// <summary>
        /// 公链展示页
        /// </summary>
        /// <returns></returns>
        public IActionResult Index()
        {
            string value = "";
            HttpContext.Request.Cookies.TryGetValue("user", out value);
            //获取登录信息
            var user = GetUser.GetUserInfo(value);
            if (user != null)
            {
                //接口调用
                var result = HttpHelper.PostWebRequest("http://localhost:112/getblock/PublicBlocksBackupList", "no=1");
                Publiclist l = JsonConvert.DeserializeObject<Publiclist>(result);
                return View(l);
            }
            else
            {
                return Redirect("/login");
            }
        }



    }
}